package com.cs.study.homework._0216;

import java.util.Scanner;

public class Bank {
    public static void main(String[] args) {

        Account account1 = new Account("000000", 100);
        Account account2 = new Account("000000", 200);
        Account account3 = new Account("000000", 300);
        Account account4 = new Account("000000", 400);

        account1.printAccount();
        account2.printAccount();
        account3.printAccount();
        account4.printAccount();

    }
}

class Account {
    //账户名
    int id;
    static int initId = 10001;
    //密码
    String password = "000000";
    //余额
    double money;
    //利息
    static double interest;
    //年利率
    double rate = 0.003;

    public Account(String password, double money) {
        this.password = password;
        this.id = initId++;
        //余额等于本金加利息
        this.money = money + interest;
    }

    public void printAccount() {
        System.out.println("请输入年限：");
        Scanner sc = new Scanner(System.in);
        int year = sc.nextInt();
        interest = rate * year * money;
        money += interest;

        System.out.println("账户名:" + id + " 密码：" + password + " 账户余额：" + money + " 利率" + rate);
    }
}
